<?php 
echo $this->partial('partials/message.phtml',array(
                'message' => "View User",
                'messageType' => "info"
 ));


/*
 * print message is if set
 * Call partial view
 * 
 */
if (isset($this->message)):
    echo $this->partial('partials/message.phtml',array(
                    'message' => $this->message,
                    'messageType' => "warning"
     ));
endif; 
?>

<article class="module width_full">
<header><h3 class="tabs_involved">View User</h3>
</header>
    

<div class="tab_container">
    <div id="tab1" class="tab_content">
        <table class="tablesorter" cellspacing="0"> 
            <?php
            /*
             * print header of the user table
             * Call partial view
             * 
             */
            echo $this->partial('partials/headTable.phtml',array(
                                'sortField' => $this->sortField,
                                'sortDir' => $this->sortDir,
                                'url' => '/admin/user/list',
                                'tableHeader' => array(
                                    'User'=>'user',
                                    'Role'=>'role',
                                    'Email'=>'email',
                                    'Member Since'=>'creation',
                                    'Last Login'=>'last_login',
                                    'Last Edit'=>'last_edit',
                                    'Active'=>'active'
                                )
                  ));
            ?>
            <tbody>
            <?php
            if (count($this->paginator) === 0):
            ?>
                <tr>
                    <td colspan="10">
                        No user register!
                    </td>
                </tr>
            <?php
            else:
                $i = 0;
                foreach ($this->paginator as $user):
                    if ($i%2==0){
                        $classth = 'class="spec"';
                        $classtd = '';
                    }else{
                        $classth = 'class="specalt"';
                        $classtd = 'class="alt"';
                    }
                    $i++;?>
                    <?php
                    /*
                     * print header of the user table
                     * Call partial view
                     * 
                     */
                    echo $this->partial('partials/bodyUserTable.phtml',array(
                                        'classth' => $classth,
                                        'classtd' => $classtd,
                                        'user'    => $user
                          ));
                endforeach;
            endif; ?>
            </tbody>
        </table>
        <?= $this->paginationControl($this->paginator); ?>
    </div>
</div>